package main

import (
	"fmt"
	"reflect"
)

type user struct {
	name string
	age int
}

func (u user) Print(){
	fmt.Printf("%v:%v",u.name,u.age)
}

func (u *user) SetName(name string){
	u.name = name
}

type userDesc struct{
	user
	sex bool
}

func (ud *userDesc) SetSex (sex bool){
	ud.sex = sex
}

func main(){
	u := userDesc{user{"jmz",12},true}
	u.SetName("haha")
	fmt.Println(u)

	v := reflect.TypeOf(&u)
	fmt.Println(v.NumMethod())
	for i,n := 0,v.NumMethod();i<n;i++{
		m := v.Method(i)
		fmt.Println(m.Name,m.Type)
	}

}


